package com.wjd.wshow.config;

import com.wjd.wshow.entity.Config;
import com.wjd.wshow.service.ConfigService;
import com.wjd.wshow.service.impl.ConfigServiceImpl;

public class ConfigManager {

    private static ConfigManager configManager = new ConfigManager();

    private ConfigManager() {}

    public static ConfigManager getInstance() {
        return configManager;
    }

    public void init() {
        ConfigService configService = ContextHolder.getInstance().getBean(ConfigServiceImpl.class);

        // 资源根目录
        Config resourceRootPath = new Config();
        resourceRootPath.setName(ConfigConstants.S_RESOURCE_ROOT.toString());
        resourceRootPath.setValue(ResourceConfig.getInstance().getRootPath());
        configService.saveConfig(resourceRootPath);
    }
}
